package com.yyt.thymeleafdemo.repository;

import com.yyt.thymeleafdemo.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author: yeyangtao
 * @date: 2019/12/24 20:46
 */
public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificationExecutor<User> {
    void deleteByIdIn(List<Long> ids);

    User findByName(String name);

    @Query(value = "select * from t_user u where u.age= (select MAX(u.age) from t_user u )",nativeQuery = true)
    User findMax();
}
